'''# Third_party'''
import eel
import threading

'''# custom'''
from common import PROJECTROOT
from GUI.utils.init_event import init
from GUI.utils.win_event import win

class visibleWindow(object):
    
    def __repr__(self) -> str:
        return "可视化操作窗口"
    
    def __init__(self) -> None:
        self.EEL = eel
        self.INIT_EVENT = init()
        self.WINDOW_EVENT = win()
    
    def __call__(self) -> None:
        '''线程执行'''
        thread = threading.Thread(target=self.__thread)
        thread.start()
        thread.join()  # 阻塞//同步
    
    def __thread(self) -> None:
        self.EEL.init(f'{PROJECTROOT}\\GUI\\web')  # 页面文件
        self.INIT_EVENT(self.EEL)  # 窗口初始化事件部署
        self.WINDOW_EVENT(self.EEL)  # 窗口控件事件部署
        self.EEL.start('main.html', port=0, size=(1250,750))  # 启动部署